package cn.com.wangluotongxin.admin.model.constants;

public enum DatabaseRunStatus {

    RUNNING(1, "执行中"),
    SUCCESS(2, "执行成功"),
    FAIL(3, "执行失败");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static DatabaseRunStatus getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            DatabaseRunStatus[] databaseRunStatuses = values();
            for(DatabaseRunStatus databaseRunStatus : databaseRunStatuses){
                if(databaseRunStatus.getCode().equals(code)){
                    return databaseRunStatus;
                }
            }
        }
        return null;
    }

    DatabaseRunStatus(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
